package com.example.musicproject_b;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.password.PasswordEncoder;


@SpringBootTest
public class totaltest {




    @Test
    public void test1() {
        // 使用PasswordEncoder，生成密码加密的测试类，控制台数据加密和未加密的字符串
        PasswordEncoder passwordEncoder = new PasswordEncoder() {
            @Override
            public String encode(CharSequence rawPassword) {
                System.out.println("加密前：" + rawPassword);
                String encodedPassword = "encoded_" + rawPassword; // 模拟加密结果
                System.out.println("加密后：" + encodedPassword);
                return encodedPassword;
            }

            @Override
            public boolean matches(CharSequence rawPassword, String encodedPassword) {
                return false; // 这里不需要实现matches方法
            }
        };

        // 测试加密
        String rawPassword = "123456";
        passwordEncoder.encode(rawPassword);
    }

}
